define(function(require, exports, module) {
	// 输入一个 Array，与 inputs 中 内容匹配
	exports.fillInput = function(arr, name4Input){
    	var isChecked = false;
    	arr.forEach(function(el){
    		if(el == name4Input){
    			isChecked = true;
    			return false;
    		}
    	});

    	return isChecked ? 'checked' : '';
	}

	// 根据生日或者日期 获取 生肖和星座的 JavaScript代码
	// 取生肖, 参数必须是四位的年    
	function getshengxiao(yyyy){
	    //by Go_Rush(阿舜) from http://ashun.cnblogs.com/
	    
	    var arr = ['猴','鸡','狗','猪','鼠','牛','虎','兔','龙','蛇','马','羊'];
	    return /^\d{4}$/.test(yyyy) ? arr [yyyy % 12] : null;
	}

	// 取星座, 参数分别是 月份和日期
	function getxingzuo(month,day){    
	    //by Go_Rush(阿舜) from http://ashun.cnblogs.com/
	        
	    var d = new Date(1999,month-1,day,0,0,0);
	    var arr = [];
	    arr.push(["魔羯座",new Date(1999, 0, 1,0,0,0)])
	    arr.push(["水瓶座",new Date(1999, 0,20,0,0,0)])
	    arr.push(["双鱼座",new Date(1999, 1,19,0,0,0)])
	    arr.push(["牡羊座",new Date(1999, 2,21,0,0,0)])
	    arr.push(["金牛座",new Date(1999, 3,21,0,0,0)])
	    arr.push(["双子座",new Date(1999, 4,21,0,0,0)])
	    arr.push(["巨蟹座",new Date(1999, 5,22,0,0,0)])    
	    arr.push(["狮子座",new Date(1999, 6,23,0,0,0)])
	    arr.push(["处女座",new Date(1999, 7,23,0,0,0)])
	    arr.push(["天秤座",new Date(1999, 8,23,0,0,0)])
	    arr.push(["天蝎座",new Date(1999, 9,23,0,0,0)])
	    arr.push(["射手座",new Date(1999,10,22,0,0,0)])
	    arr.push(["魔羯座",new Date(1999,11,22,0,0,0)])        
	    for(var i = arr.length - 1;i >= 0;i--){
	        if (d >= arr[i][1]) return arr[i][0];    
	    }
	}

	/*
	魔羯座(12/22 - 1/19)、水瓶座(1/20 - 2/18)、双鱼座(2/19 - 3/20)、牡羊座(3/21 - 4/20)、金牛座(4/21 - 5/20)、
	双子座(5/21 - 6/21)、巨蟹座(6/22 - 7/22)、狮子座(7/23 - 8/22)、处女座(8/23 - 9/22)、天秤座(9/23 - 10/22)、
	天蝎座(10/23 - 11/21)、射手座(11/22 - 12/21)    
	*/

	// 根据身份证号码取  省份，生日
	//根据身份证取 省份,生日，性别  Go_Rush(阿舜) from http://ashun.cnblogs.com/
	function getInfo(id) {
		var arr = [null,null,null,null,null,null,null,null,null,null,null,"北京","天津","河北","山西","内蒙古"
	             ,null,null,null,null,null,"辽宁","吉林","黑龙江",null,null,null,null,null,null,null,"上海"
	             ,"江苏","浙江","安微","福建","江西","山东",null,null,null,"河南","湖北","湖南","广东","广西","海南"
	             ,null,null,null,"重庆","四川","贵州","云南","西藏",null,null,null,null,null,null,"陕西","甘肃"
	             ,"青海","宁夏","新疆",null,null,null,null,null,"台湾",null,null,null,null,null,null,null,null
	             ,null,"香港","澳门",null,null,null,null,null,null,null,null,"国外"];

	    id = checkId(id);
		
		if (isNaN(id)) return "错误的身份证号码";
		
		var id = String(id),
			prov = arr[id.slice(0, 2)],
			sex = id.slice(14, 17) % 2 ? "男" : "女";
		var birthday = (new Date(id.slice(6, 10), id.slice(10, 12) - 1, id.slice(12, 14))).toLocaleDateString();

		return [prov, birthday, sex];
	}

	function checkId(pId) {
		//检查身份证号码 Go_Rush(阿舜) from http://ashun.cnblogs.com

		var arrVerifyCode = [1, 0, "x", 9, 8, 7, 6, 5, 4, 3, 2];
		var Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
		var Checker = [1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1];

		if (pId.length != 15 && pId.length != 18) return "身份证号共有 15 码或18位";

		var Ai = pId.length == 18 ? pId.substring(0, 17) : pId.slice(0, 6) + "19" + pId.slice(6, 16);

		if (!/^\d+$/.test(Ai)) return "身份证除最后一位外，必须为数字！";

		var yyyy = Ai.slice(6, 10),
			mm = Ai.slice(10, 12) - 1,
			dd = Ai.slice(12, 14);

		var d = new Date(yyyy, mm, dd),
			now = new Date();
		var year = d.getFullYear(),
			mon = d.getMonth(),
			day = d.getDate();

		if (year != yyyy || mon != mm || day != dd || d > now || year < 1940) return "身份证输入错误！";

		for (var i = 0, ret = 0; i < 17; i++) ret += Ai.charAt(i) * Wi[i];
		Ai += arrVerifyCode[ret %= 11];

		return pId.length == 18 && pId != Ai ? "身份证输入错误！" : Ai;
	}
});